package cn.doitedu.hebust.pre

import org.apache.spark.sql.DataFrame

object DictLoadUtil {

  /**
    * 将地域字典数据加载为一个driver端的map对象
    * @param dictDF
    * @return
    */
  def loadAreaDict(dictDF:DataFrame): collection.Map[String, (String, String, String)] =  {

    dictDF.rdd
      .map(row => {
        val geo = row.getAs[String]("geo")
        val province = row.getAs[String]("province")
        val city = row.getAs[String]("city")
        val district = row.getAs[String]("district")
        (geo, (province, city, district))
      }).collectAsMap()
  }

}
